package godis

type StringResult struct {
	Result string
	Err    error
}

func NewStringResult(result string, err error) *StringResult {
	return &StringResult{
		Result: result,
		Err:    err,
	}
}

func (self *StringResult) UnWarp() string {
	if self.Err != nil {
		panic(self.Err)
	}
	return self.Result
}

func (self *StringResult) UnWarpOrElse(f func() string) string {
	if self.Err != nil {
		return f()
	}
	return self.Result
}
